<template>
  <div class="box" v-if="visible">
    <div class="model">
      <div class="model-header">
        <span @click="closeFun">X</span>
      </div>
      <div>
        <slot></slot>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      //    show:false
    };
  },
  methods: {
    closeFun(){
        // 只读
        // this.visible = false
        this.$emit("update:visible",false)
    }
  },
};
</script>

<style scoped>
.box {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  background-color: rgba(0, 0, 0, 0.322);
}
.model {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 380px;
  height: 260px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 0 3px 3px #777;
}
.model-header {
  height: 50px;
  border-bottom: 1px solid #535353;
}
.model-header span {
  float: right;
  width: 50px;
  height: 50px;
  font-size: 40px;
  font-weight: bold;
}
</style>